﻿<ResourceDictionary  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:ctrl="clr-namespace:BuiltToRoam.WindowsPhone.Controls;assembly=BuiltToRoam.WindowsPhone.Controls">

    <ctrl:BoolVisibilityConverter x:Key="BoolVisibilityConverter" />

    <Style x:Key="WheelItem" TargetType="ListBoxItem">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="4"/>
        <Setter Property="BorderBrush" Value="#577E7E7E"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="Height" Value="150" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border x:Name="LayoutRoot" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
							HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalAlignment}" 
							Margin="0,3" Background="#FF121212" 
                            Visibility="{Binding IsVisible, Converter={StaticResource BoolVisibilityConverter}}" >

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Disabled"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected"/>
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ColorAnimation Duration="0" To="#577E7E7E" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="LayoutRoot" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="SelectedUnfocused">
                                    <Storyboard>
                                        <ColorAnimation Duration="0" To="#577E7E7E" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="LayoutRoot" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Unfocused"/>
                                <VisualState x:Name="Focused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" 
                                        Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalContentAlignment="Stretch" 
							/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ctrl:Wheel">
        <Setter Property="Background" Value="Transparent"/>
    			<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
    			<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/>
    			<Setter Property="BorderThickness" Value="0"/>
    			<Setter Property="BorderBrush" Value="Transparent"/>
    			<Setter Property="Padding" Value="0"/>

        
        <Setter Property="Template">
    				<Setter.Value>
    					<ControlTemplate TargetType="ctrl:Wheel">
    						<Border BorderBrush="Blue" BorderThickness="1,0,1,0" >
                        <Border.Resources>
                            <Storyboard x:Name="SnapAnimation">
                                <!-- Animate from top to bottom -->
                                <DoubleAnimation
                Storyboard.TargetName="Mediator"
                Storyboard.TargetProperty="VerticalOffset"
                From="0"
                To="100"
                Duration="0:0:0.5">
                                    <DoubleAnimation.EasingFunction>
                                        <!-- Ease in and out -->
                                        <ExponentialEase EasingMode="EaseInOut"/>
                                    </DoubleAnimation.EasingFunction>
                                </DoubleAnimation>
                            </Storyboard>
                        </Border.Resources>
                            <Grid x:Name="LayoutRoot">
                                <ScrollViewer x:Name="Scroller" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Hidden">
                                    <StackPanel>
                                        <Border x:Name="TopStop"  Background="{TemplateBinding Background}"></Border>
						                    <ItemsPresenter/>
                                        <Border x:Name="BottomStop" Background="{TemplateBinding Background}"></Border>
                                    </StackPanel>
                                </ScrollViewer>
    								
                            <!-- Mediator that forwards the property changes-->
    								<ctrl:ScrollViewerOffsetMediator
    									x:Name="Mediator"
    									ScrollViewer="{Binding ElementName=Scroller}" Visibility="Collapsed"/>
                        </Grid>
    						</Border>
    					</ControlTemplate>
    				</Setter.Value>
    			</Setter>
        <Setter Property="ItemContainerStyle" Value="{StaticResource WheelItem}" />
        <!--<Setter Property="ItemTemplate" Value="{StaticResource WheelItemTemplate}" />-->
     			<!--<Setter Property="ItemsPanel" Value="{StaticResource ItemsPanelTemplate1}" />
    			<Setter Property="ItemTemplate" Value="{StaticResource ItemTemplate}" />-->
            
    </Style>
</ResourceDictionary>
